package org.deschutter.hibernate;

import java.math.BigDecimal;
import org.deschutter.hibernate.Actions;

import javax.persistence.*;
import java.util.Collection;

/**
 * User: Berten De Schutter
 * Date: 01-Oct-2009
 * Time: 13:40:07
 */
@Entity
@Table(catalog = "scimitar", name = "scans")
public class Scans {
    private String id;

    @Id
    @Column(name = "ID")
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    private String planetname;

    @Basic
    @Column(name = "planetname")
    public String getPlanetname() {
        return planetname;
    }

    public void setPlanetname(String planetname) {
        this.planetname = planetname;
    }

    private String rulername;

    @Basic
    @Column(name = "rulername")
    public String getRulername() {
        return rulername;
    }

    public void setRulername(String rulername) {
        this.rulername = rulername;
    }

    private BigDecimal tick;

    @Basic
    @Column(name = "tick")
    public BigDecimal getTick() {
        return tick;
    }

    public void setTick(BigDecimal tick) {
        this.tick = tick;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Scans scans = (Scans) o;

        if (tick != scans.tick) return false;
        if (id != null ? !id.equals(scans.id) : scans.id != null) return false;
        if (planetname != null ? !planetname.equals(scans.planetname) : scans.planetname != null) return false;
        if (rulername != null ? !rulername.equals(scans.rulername) : scans.rulername != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (planetname != null ? planetname.hashCode() : 0);
        result = 31 * result + (rulername != null ? rulername.hashCode() : 0);
        result = 31 * result + tick.intValue();
        return result;
    }

    private Collection<Actions> actionsesById;

    @OneToMany(mappedBy = "scansByScanId")
    public Collection<Actions> getActionsesById() {
        return actionsesById;
    }

    public void setActionsesById(Collection<Actions> actionsesById) {
        this.actionsesById = actionsesById;
    }

    private Collection<Development> developmentsById;

    @OneToMany(mappedBy = "scansByScanId")
    public Collection<Development> getDevelopmentsById() {
        return developmentsById;
    }

    public void setDevelopmentsById(Collection<Development> developmentsById) {
        this.developmentsById = developmentsById;
    }

    private Collection<Jumpgate> jumpgatesById;

    @OneToMany(mappedBy = "scansByScanId")
    public Collection<Jumpgate> getJumpgatesById() {
        return jumpgatesById;
    }

    public void setJumpgatesById(Collection<Jumpgate> jumpgatesById) {
        this.jumpgatesById = jumpgatesById;
    }

    private Collection<News> newsesById;

    @OneToMany(mappedBy = "scansByScanId")
    public Collection<News> getNewsesById() {
        return newsesById;
    }

    public void setNewsesById(Collection<News> newsesById) {
        this.newsesById = newsesById;
    }

    private Collection<Planet> planetsById;

    @OneToMany(mappedBy = "scansByScanId")
    public Collection<Planet> getPlanetsById() {
        return planetsById;
    }

    public void setPlanetsById(Collection<Planet> planetsById) {
        this.planetsById = planetsById;
    }

    private Collection<ScanUser> scanUsersById;

    @OneToMany(mappedBy = "scansByScanId")
    public Collection<ScanUser> getScanUsersById() {
        return scanUsersById;
    }

    public void setScanUsersById(Collection<ScanUser> scanUsersById) {
        this.scanUsersById = scanUsersById;
    }

    private ScanType scanTypeByTypeId;

    @ManyToOne
    @JoinColumn(name = "type_id", referencedColumnName = "ID")
    public ScanType getScanTypeByTypeId() {
        return scanTypeByTypeId;
    }

    public void setScanTypeByTypeId(ScanType scanTypeByTypeId) {
        this.scanTypeByTypeId = scanTypeByTypeId;
    }

    private Collection<Unit> unitsById;

    @OneToMany(mappedBy = "scansByScanId")
    public Collection<Unit> getUnitsById() {
        return unitsById;
    }

    public void setUnitsById(Collection<Unit> unitsById) {
        this.unitsById = unitsById;
    }
}
